<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport"
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
		<link rel="stylesheet" href="../../../css/common.css" media="all">

		<style type="text/css">
			.show_img_ul {
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				margin-top: 10px;
			}

			.show_img_li {
				text-align: center;
				padding: 10px;
			}

			.show_img_li p,
			.show_img_li1 p {
				text-align: center;
				cursor: pointer;
			}

			.show_img_li img {
				width: 120px;
				height: 120px;
				margin-bottom: 8px;
			}

			.show_img_li1 img {
				width: 300px;
				height: 200px;
				margin-bottom: 8px;
			}

			.layui-upload-img {
				width: 92px;
				height: 92px;
				margin: 0 10px 10px 0;
			}
		</style>
	</head>

	<body>

		<div class="layui-fluid">
			<div class="layui-row" id="view">
				<form class="layui-form" lay-filter="test_detail">
					<div class="layui-card">
						<div class="layui-card-body">
							<div class="layui-form-item">
								<label class="layui-form-label">收货人<span style="color: red;">*</span></label>
								<div class="layui-input-block">
									<input type="text" name="consignee" id="consignee" lay-verify="required"
										placeholder="请输入收货人姓名" autocomplete="off" class="layui-input">
								</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label">验证手机</label>
								<div class="layui-input-inline">
									<input type="tel" name="mobile" id="mobile" lay-verify="required|phone"
										autocomplete="off" class="layui-input" value="">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">地区名称</label>
								<div class="layui-input-block">
									<textarea placeholder="地区名称" name="areaname" id="areaname" class="layui-textarea"
										value=""></textarea>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">详细地址</label>
								<div class="layui-input-block">
									<textarea placeholder="详细地址" name="address" id="address" class="layui-textarea"
										value=""></textarea>
								</div>
							</div>
						</div>
					</div>

					<div class="layui-form-item layui-layout-admin">
						<div class="layui-input-block">
							<div class="layui-footer" style="left: 0;">
								<button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
		<script src="../../../layuiadmin/layui/layui.js"></script>
		<script src="../../../js/jquery.min.js"></script>
		<script src="../../../js/jquery.jqprint-0.3.js"></script>
		<script src="../../../js/ace/ace.js"></script>
		<script src="../../../js/common.js"></script>
		<script>
			var _data = {
				id: getParam('orderid'),
				orderid: getParam('orderid'),

			}
			layui.config({
				base: '../../../layuiadmin/' //静态资源所在路径
			}).extend({
				tinymce: '../tinymce/tinymce', //主入口模块
				index: 'lib/index' //主入口模块
			}).use(['index', 'form', 'laytpl', 'laydate', 'layedit', 'upload', 'uploadnew', 'tinymce'], function() {
				var $ = layui.$,
					admin = layui.admin,
					upload = layui.upload,
					laytpl = layui.laytpl,
					laydate = layui.laydate,
					layedit = layui.layedit,
					uploadnew = layui.uploadnew,
					tinymce = layui.tinymce,
					form = layui.form;
				goods_status_show('radio');

				if (_data.id) {
					initdata();
				}

				var img_arr1 = [],
					img_arr2 = [];

				//监听提交
				form.on('submit(demo1)', function(data) {
					var data = data.field;
					var lock = false
					layer.confirm('确定要提交数据？', function() {
						if (!lock) {
							lock = true
							if (_data.id) {
								_data.consignee = data.consignee
								_data.mobile = data.mobile
								_data.areaname = data.areaname
								_data.address = data.address
								submitdata(server.server_order_edit);
							} else {
								console.log(_data)
							}
						}
					}, function() {
						layer.msg('取消操作');
					});
					return false;
				});

				function submitdata(_url) {
					$.post(_url, _data, function(res, status) {
						if (status == 'success') {
							if (res.code == 0) {
								layer.alert('操作成功', function() {
									parent.layer.closeAll(); //关闭所有弹框
									parent.location.reload() //重新加载父级页面
								});
							} else {
								layer.msg(res.msg);
							}
							closeloading();
						} else {
							closeloading();
							layer.msg('服务器连接错误');
						}
					});
				}


				function initdata() {
					$.get(server.queryordersdetail, _data, function(res, status) {
						if (status == 'success') {
							if (res.code == 0) {
								var data = res.orders_detail
								form.val("test_detail", data.data);
								form.render();
							} else {
								layer.msg(res.msg);
							}
						} else {
							layer.msg('服务器连接错误');
						}
					});
				}

				//时间选择器
				laydate.render({
					elem: '#server_times',
					type: 'time'
				});

				//常规用法
				laydate.render({
					elem: '#serve_dates'
				});
			});
		</script>
	</body>

</html>
